
package com.yuan.graduate;

import com.yuan.application.BaseActivity;
import com.yuan.model.M考勤表;
import com.yuan.prefence.FileConstants;
import com.yuan.unit.AsyncDataJobHandler;
import com.yuan.unit.FileUtils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

/**
 * 考勤详情界面
 * 
 * @author YUAN
 */
@SuppressLint("HandlerLeak")
public class CheckDetailActivity extends BaseActivity {

    @SuppressWarnings("unused")
    private Context mContext = null;
    private Handler mHandler = null;
    private TextView checkdetail_name_info, checkdetail_date_info, checkdetail_team_info,
            checkdetail_mark_info, checkdetail_adress_info, checkdetail_remark_info;
    private String date = "";

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        setContentView(R.layout.activity_checkdetail);
        mHandler = new Handler() {
            public void handleMessage(Message msg) {
                switch (msg.what)
                {
                    case GETCHECKSUCCEED:
                        updateData();
                        break;
                    case GETCHECKFILLED:
                        break;

                }
            }

        };
        initView();
    }

    private void initView() {
        // TODO Auto-generated method stub
        date = getIntent().getExtras().getString("date");
        checkdetail_name_info = (TextView) findViewById(R.id.checkdetail_name_info);
        checkdetail_date_info = (TextView) findViewById(R.id.checkdetail_date_info);
        checkdetail_team_info = (TextView) findViewById(R.id.checkdetail_team_info);
        checkdetail_mark_info = (TextView) findViewById(R.id.checkdetail_mark_info);
        checkdetail_adress_info = (TextView) findViewById(R.id.checkdetail_adress_info);
        checkdetail_remark_info = (TextView) findViewById(R.id.checkdetail_remark_info);
        AsyncDataJobHandler.getInstance().getcheck(mHandler, date);
    }

    private void updateData() {
        // TODO Auto-generated method stub
        try {
            M考勤表.getInstance().setFromObject(
                    FileUtils.File2erializable(FileConstants.SERIALIZABLE_查看考勤记录));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        checkdetail_name_info.setText(M考勤表.getInstance().get职工姓名());
        checkdetail_date_info.setText(M考勤表.getInstance().get日期().subSequence(0, 10));
        checkdetail_team_info.setText(M考勤表.getInstance().get所属队室());
        checkdetail_mark_info.setText(M考勤表.getInstance().get出勤标示());
        checkdetail_adress_info.setText(M考勤表.getInstance().get位置());
        checkdetail_remark_info.setText(M考勤表.getInstance().get备注());
    }
}
